#pragma once

#define NET_EVENT_TERMINATE     1
#define NET_EVENT_DATA		    2
#define NET_EVENT_ERROR		    3
#define NET_EVENT_CONNECT	    4
#define NET_EVENT_ACCEPT	    5
#define NET_EVENT_RECV_ACTIVE   6

#define NET_REQ_SEND            1
#define NET_REQ_CLOSE           2
#define NET_REQ_CONNECT         3
#define NET_REQ_RECV            4

struct s_net_evt_connect
{
    UINT32 ip;
    UINT16 port;
};

struct accept_info_1
{
    SOCKET accept_socket;
};

struct accept_info_2
{
    UINT32 local_ip;
    UINT32 peer_ip;
};

struct accept_info_3 
{
    void* accept_socket;
};

struct s_net_evt_accept
{
    union
    {
        accept_info_1 accept1;
        accept_info_2 accept2;
        accept_info_3 accept3;
    };
};

struct s_net_evt_terminate 
{
};

struct s_net_evt_data 
{
    INT32 data_len;
};

struct s_net_evt_error 
{
    INT32	moudle_error;
    UINT32	system_error;
};

struct s_net_evt_recv_active 
{
    INT32   last_data_size;
};

struct s_net_event 
{
    UINT32	evt_type;
    void*	evt_socket;
    union
    {
        s_net_evt_connect       evt_connect;
        s_net_evt_accept        evt_accept;
        s_net_evt_terminate     evt_terminate;
        s_net_evt_data          evt_data;
        s_net_evt_error         evt_error;
        s_net_evt_recv_active   evt_recv_active;
    };
};